package com.hldsmart.smartda.activity.scan;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.hldsmart.smartda.R;
import com.hldsmart.smartda.base.BaseActivity;
import com.hldsmart.smartda.commonutils.widget.CustomDialog;

import butterknife.Bind;
import butterknife.ButterKnife;

public class GoodScanActivity extends BaseActivity implements View.OnClickListener {

    @Bind(R.id.iv_back)
    ImageView iv_back;
    @Bind(R.id.bt_group)
    Button bt_group;
    @Bind(R.id.tv_goodsName)
    TextView tv_goodsName;
    private String url;

    public static void startGoodScanActivity(Context context,String resultString) {


        Intent resultIntent = new Intent(context, GoodScanActivity.class);
        resultIntent.putExtra("result", resultString);
        context.startActivity(resultIntent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_good_detail);
        ButterKnife.bind(this);

        url=getIntent().getStringExtra("result");
//        tv_string.setText(url+"");
        setListener();


    }

    private void setListener() {
        iv_back.setOnClickListener(this);
        bt_group.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.bt_group:
                CustomDialog.Builder builder = new CustomDialog.Builder(this);
                builder.setTitle(R.string.prompt);
                builder.setMessage("我要发起"+tv_goodsName.getText().toString()+"的现场团购");
                builder.setPositiveButton(R.string.confirm, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //发起团购操作


                        dialog.dismiss();
                    }
                });
                builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });
                builder.create().show();
                break;
        }
    }
}
